<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@page import="java.lang.System"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.ArrayList"%>
<%@page import="javax.servlet.http.HttpServletRequest"%>
<%@page import="org.dinnermate.reservation.ReservationSlot"%>
<%!
	public String generateString(ReservationSlot slot, HttpServletRequest request)
	{
		return slot.getStartTime().getTime()+"~"
				+slot.getTable().getID()+"~"
				+request.getAttribute("NumOfSeats")+"~"
				+request.getAttribute("PhoneNumber")+"~"
				+request.getAttribute("Name");
	}
%>

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/AllPages.css">
		<link rel="stylesheet" type="text/css" href="css/Listing.css">
	</head>
	
	<body>
	<html:form action="/ToReservationAcceptedFromListing.do">
	<table border="1">
		<tr>
			<td  colspan = 2 align="center">
			<b><font size="6">Please specify a reservation time.</font></b>
			</td>
		</tr>
	<% 	if (request.getAttribute("ReservationSlots") != null)
	{
	int counter = 0;
		ArrayList<ReservationSlot> slots = (ArrayList<ReservationSlot>)request.getAttribute("ReservationSlots");
		for (ReservationSlot slot: slots)
		{%>
		<tr>
			<td class="left" align="right">
				<html:radio property="listing" value="<%=generateString(slot, request)%>" title="<%=slot.getStartTime().toString()%>"/>
			</td>
			<td class="right">
				<p><%=slot.getStartTime().toString()%></p>
			</td>
		</tr>
		<%
		counter++;}
	}
	%>
	<tr>
		<td align="right">
			<html:submit value="Submit"/>
			</td>
		<td>
			<html:cancel value="Back"/>
		</td>
	</tr>
	</table>
	</html:form>
	</body>
</html>